import pickle
import base64


def dumps(dict1):
    # 将字典转成字节
    b1 = pickle.dumps(dict1)
    # 加密
    b2 = base64.b64encode(b1)
    # 转字符串
    return b2.decode()


def loads(str1):
    # 转字节
    b1 = str1.encode()
    # 解密
    b2 = base64.b64decode(b1)
    # 转字典
    return pickle.loads(b2)

